// pages/tongxian/tongxian.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    L3code: '', //区数据
  },

  search_but() {
    wx.request({
      url: app.globalData.interface+'/xianyangTicket/API_1819_XianYangNetworkStatistics',
      method: 'GET',
      data: {
        queryType: '3',
        NETWORK: this.data.L3code,
        OPEN_ID: this.data.openid, //用户OPEN_ID
        session_key:this.data.session_key,
        OPEN_UUID:this.data.jiami
        // L3code: '',
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: res => {

        // console.log(res.data.data);
        // var CUSTOMER_TEL = res.data.data.CUSTOMER_TEL
        // CUSTOMER_TEL = "" + CUSTOMER_TEL;
        // var CUSTOMER_TEL = CUSTOMER_TEL.substr(0, 3) + "****" + CUSTOMER_TEL.substr(7)
        // console.log(CUSTOMER_TEL)
        const shusp = res.data.data
        const liscop = shusp.map((item) => {
          console.log(item);


        var CUSTOMER_TEL = item.POST_SENT_HOME_PHONE
        CUSTOMER_TEL = "" + CUSTOMER_TEL;
        var CUSTOMER_TEL = CUSTOMER_TEL.substr(0, 3) + "****" + CUSTOMER_TEL.substr(7)
        console.log(CUSTOMER_TEL)
          return {
            ...item,
            POST_SENT_HOME_PHONE: CUSTOMER_TEL
          }

        })
        console.log(liscop);

        this.setData({
          information:liscop,
        })

      }
    })
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(e) {
    console.log(e.data);
    this.setData({
      L3code: e.data,
      openid: app.globalData.openid,
      jiami: app.globalData.jiami,
      OPEN_ID: app.globalData.openid,
      session_key: app.globalData.session_key,
    })
    console.log(e.data);

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.search_but()
    console.log(this.data.L3code);
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})